
from django.urls import path,re_path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
from user.views import (
    CreateUserViews,
    RegisterViews,
    EmailApiView,
    PhoneApiView,
    SmsApiView,
    SmsLoginView,
    PasswordLoginView,
    EmailViews,
    DingTalkLogin,
    DingTalkCallback,
)

urlpatterns = [
    # 获取token
    path('jwt/access/',TokenObtainPairView.as_view()),
    # 刷新touekn
    path('jwt/refresh/',TokenRefreshView.as_view()),
    # 校验token
    path('jwt/verify/',TokenVerifyView.as_view()),
    # 测试视图
    path('createuser/',CreateUserViews.as_view()),

    # 动态路由转换器 <int:phone>
    # re_path
    re_path(r'^phone/(?P<phone>1[3-9]\d{9})/$', PhoneApiView.as_view()),
    # 注册发送验证码
    re_path(r'^sendsms/(?P<phone>1[3-9]\d{9})/$', SmsApiView.as_view()),

    # 动态路由转换器 <int:email>
    # re_path
    re_path(r'^email/(?P<email>1[3-9]\d{9})/$', EmailApiView.as_view()),

    # 手机号注册
    path('phone_register/',RegisterViews.as_view()),
    # 
    path('email_register/',EmailViews.as_view()),
    # 邮箱注册
    path('sms_login/', SmsLoginView.as_view()),
    # 密码登录
    path('password_login/', PasswordLoginView.as_view()),
    
    # 钉钉登录
    path('dingtalklogin/', DingTalkLogin.as_view()),
    # 回调钉钉
    path('dingtalkcallback/', DingTalkCallback.as_view()),
]
